<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/reset.css">
    <link rel="stylesheet" href="./css/common.css">
    <link rel="stylesheet" href="./css/banner.css">
    <link rel="stylesheet" href="./css/item.css">

</head>

<body>
    <!-- 轮播图 -->
    <div class="banner">
        <ul class="banner-list">
        </ul>
        <ul class="indicator">
        </ul>
    </div>

    <!-- 内容 -->
    <div class="wrapper">
        <div class="crumbs">
            <a class="item" href="#">首页</a>
            <span class="split">&gt;</span>
            <a class="item" href="#">笔记本</a>
        </div>

        <div class="menu">
            <div class="category list">
                <div class="item">分类：</div>
                <div class="item">
                    <span>笔记本</span>
                </div>
                <div class="item">
                    <span>台式机</span>
                </div>
                <div class="item">
                    <span>智慧屏</span>
                </div>
            </div>
            <div class="discount list">
                <div class="item">服务优惠：</div>
                <div class="item">
                    <span>仅看有货</span>
                </div>
                <div class="item">
                    <span>分期免息</span>
                </div>
                <div class="item">
                    <span>优惠商品</span>
                </div>
            </div>
            <div class="sort list">
                <div class="item">排序：</div>
                <div class="item active" data-key="default">
                    <span>综合</span>
                </div>
                <div class="item" data-key="new">
                    <span>最新</span>
                </div>
                <div class="item" data-key="rateCount">
                    <span>评论数</span>
                </div>
                <div class="item" data-key="price">
                    <span>价格</span>
                </div>
            </div>
        </div>

        <ul class="product">
            <!-- <li class="item">
        <a href="#">
          <img class="album" src="./img/product_01.webp" alt="">
          <div class="title">HUAWEI MateBook E 12.6英寸</div>
          <div class="discount">
            预订立省300元|12期免息
          </div>
          <div class="price">¥6499</div>
          <div class="welfare">
            <span class="tip">分期免息</span>
            <span class="tip">赠送积分</span>
          </div>
          <div class="comment">
            <span class="count">
              6029人评价
            </span>
            <span class="rate">
              97% 好评
            </span> 
          </div>
        </a>
      </li> -->
        </ul>
    </div>

    <script src="./data/data.js"></script>
    <script src="./data/banner.js"></script>
    <script src="./js/banner.js"></script>
    <!-- <script src="./js/product.js"></script> -->
    <!-- <script src="./data/item.js"></script> -->
    <script>
        var baseURL = "https://res.vmallres.com/pimages"
        var productEL = document.querySelector(".product")

        function showResultList() {
            for (var i = 0; i < resultList.length; i++) {
                var resultItem = resultList[i]
                var itemEL = document.createElement("li")
                itemEL.classList.add("item")


                var servicestring = ''
                for (leble of resultItem.promoLabels) {
                    servicestring += `<span class="tip">${leble}</span>`
                }
                itemEL.innerHTML = `
              <a href="#">
            <img class="album" src="${baseURL}${resultItem.photoPath}428_428_${resultItem.photoName}" alt="">
            <div class="title">${resultItem.name}</div>
            <div class="discount">
            ${resultItem.promotionInfo}
            </div>
            <div class="price">¥${resultItem.price}</div>
            <div class="welfare">
              ${servicestring}
            </div>
            <div class="comment">
              <span class="count">
                ${resultItem.priceAccurate}人评价
              </span>
              <span class="rate">
                ${resultItem.goodRate}% 好评
              </span> 
            </div>
              </a>
              `
                productEL.append(itemEL)
            }
            for (var i = 0; i < 3; i++) {
                var emptyLi = document.createElement("li")
                emptyLi.className = "item empty"
                productEL.append(emptyLi)
            }
        }
        showResultList()
    </script>

</body>

</html>